import repositories from "./data/repositories";
import { ref, onMounted, watch } from "vue";
type repositorieType = {
  position: String;
  type: String;
};
export default function useUserRepositorie(position) {
  const repositorie: any = ref({});
  const getUserRepositorie = async () => {
    repositories.some((dataItem) => {
      if (dataItem.position === position.value) {
        repositorie.value = dataItem;
        return true;
      }
    });
  };

  onMounted(getUserRepositorie);
  watch(position, getUserRepositorie);

  return {
    repositorie,
    getUserRepositorie,
  };
}
